#include <iostream>
using namespace std;

int main() {
    int m;
    cin >> m;
    int min=0,max=0;
    for (int i = 0; i < m; i++)
    {
        int temp = 0;
        cin >> temp;
        if (min == 0)
        {
            min = temp;
        }
        if (max == 0)
        {
            max = temp;
        }
        
        if (temp > max)
        {
            max = temp;
        }
        if (temp < min)
        {
            min = temp;
        }
    }
    cout << max-min;

    return 0;
}